package com.atguigu.lease.model.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;


public enum ItemType implements BaseEnum {

    APARTMENT(1, "公寓"),

    ROOM(2, "房间");
    //@JsonValue
     //这个注解把返回的json字符串里的ItemType对象映射成code值返回
    //@EnumValue
     //这个注解把controller方法里传入的ItemType对象映射成code值，传入数据库寻找数据。
@EnumValue
@JsonValue
    private Integer code;

    private String name;

    @Override
    public Integer getCode() {
        return this.code;
    }


    @Override
    public String getName() {
        return name;
    }

    ItemType(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

}
